package com.cenxi.controller;

import com.cenxi.common.dto.LoginUserDTO;
import com.cenxi.common.dto.req.LoginReqDTO;
import com.cenxi.common.util.req.Req;
import com.cenxi.common.util.resp.Resp;
import com.cenxi.manage.ManageLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author cenxi
 * @Date 2023/8/16 17:31
 * @Version 1.0
 */
@RestController
@RequestMapping("/auth")
@Api(tags = {"验证中心"})
public class AuthController {
    @Autowired
    private ManageLoginService manageLoginService;

    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public Resp<LoginUserDTO> login(@RequestBody Req<LoginReqDTO> req) {
        return manageLoginService.login(req.getData());
    }

    @PostMapping("/logout")
    @ApiOperation(value = "退出")
    public Resp<Void> logout(@RequestBody Req<Void> req) {
        return manageLoginService.logout();
    }
}
